//
//  LJHAlbumHeadView.m
//  HEARME
//
//  Created by liujinhui on 16/1/27.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LJHAlbumHeadView.h"

@implementation LJHAlbumHeadView
-(void)dealloc
{
    [_playIcon release];
    [_playCount release];
    [_favorBtn release];
    [_authorName release];
    [_albumPic release];
    [_albumDigest release];
    [super dealloc];
}


-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    
    return self;
}
-(void)createSubviews
{
    
    
    //专辑图片
    self.albumPic = [[UIImageView alloc] initWithFrame:CGRectMake(10, 20, 90, 90) ];
    // self.albumPic.backgroundColor = CLEAR;
    [self addSubview:self.albumPic];
    [_albumPic release];
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.albumPic.frame.size.width, self.albumPic.frame.size.height)];
    imageView.image = [UIImage imageNamed:@"placeholder_cell_same"];
    [self.albumPic addSubview:imageView];
    
    //主播头像
    self.avatarBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.avatarBtn.frame = CGRectMake(self.albumPic.frame.origin.x + self.albumPic.frame.size.width + 10, self.albumPic.frame.origin.y , 30, 30);
    self.avatarBtn.backgroundColor = [UIColor clearColor];
    self.avatarBtn.layer.masksToBounds = YES;
    self.avatarBtn.layer.cornerRadius = 15;
    self.avatarBtn.layer.borderWidth = 1;
    //    self.avatarBtn.layer.borderColor = ;
    [self.avatarBtn setImage:[UIImage imageNamed:@"placeholder_cell_cicle"] forState:UIControlStateNormal];
    [self addSubview:self.avatarBtn];
    
    //主播名字
    self.authorName = [[UILabel alloc] initWithFrame:CGRectMake(self.avatarBtn.frame.origin.x + self.avatarBtn.frame.size.width + 10, self.albumPic.frame.origin.y + 5, 100, 20)];
    self.authorName.backgroundColor = [UIColor clearColor];
    self.authorName.textColor = [UIColor whiteColor];
    self.authorName.font = [UIFont systemFontOfSize:15 weight:1];
    [self addSubview:self.authorName];
    [_authorName release];
    
    //专辑简介
    self.albumDigest = [[UILabel alloc] initWithFrame:CGRectMake(self.avatarBtn.frame.origin.x  + 10 ,self.avatarBtn.frame.origin.y + self.avatarBtn.frame.size.height+10, 200, 20)];
    self.albumDigest.backgroundColor = [UIColor clearColor];
    self.albumDigest.font = [UIFont systemFontOfSize:13 weight:0];
    [self addSubview:self.albumDigest];
    self.albumDigest.textColor = [UIColor grayColor];
    [_albumDigest release];
    
    
    //分类按钮
    self.tagBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.tagBtn.frame = CGRectMake(self.albumDigest.frame.origin.x, self.albumDigest.frame.origin.y + self.albumDigest.frame.size.height + 10, 20, 20);
    self.tagBtn.backgroundColor = [UIColor clearColor];
    //    [self.tagBtn setImage:[UIImage imageNamed:@"cell_arrow@2x.png"] forState:UIControlStateNormal];
    [self addSubview:self.tagBtn];
    
    
    //    //下一页按钮
    //    self.nextBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    //    self.nextBtn.frame = CGRectMake(self.albumDigest.frame.origin.x + self.albumDigest.frame.size.width + 10, self.albumDigest.frame.origin.y , 30, 30);
    //    self.nextBtn.backgroundColor = CLEAR;
    //    [self.nextBtn setImage:[UIImage imageNamed:@"cell_arrow@2x.png"] forState:UIControlStateNormal];
    //    [self addSubview:self.nextBtn];
    
    //收藏按钮
    self.favorBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.favorBtn.frame = CGRectMake(self.albumPic.frame.origin.x + self.albumPic.frame.size.width + 10, self.avatarBtn.frame.origin.y + self.avatarBtn.frame.size.height + 30, WIDTH/7, WIDTH/4.5);
    self.favorBtn.backgroundColor = [UIColor clearColor];
    [self.favorBtn setImage:[UIImage imageNamed:@"album_collected_non@2x.png"] forState:UIControlStateNormal];
    //    [self.favorBtn setImage:[UIImage imageNamed:@"album_collected@2x.png"] forState:UIControlStateHighlighted];
    
    [self addSubview:self.favorBtn];
    
    
    
    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
